package com.lujianfei.powerinput.ui.setting.presenter;

import android.content.Intent;
import android.view.View;
import android.widget.AdapterView;

import com.lujianfei.powerinput.R;
import com.lujianfei.powerinput.ui.about.AboutActivity;
import com.lujianfei.powerinput.ui.setting.base.SettingContract;
import com.lujianfei.powerinput.ui.template.TemplateActivity;
import com.lujianfei.powerinput.utils.ResUtils;

public class SettingPresenter implements SettingContract.Presenter {
    private final SettingContract.View view;

    public SettingPresenter(SettingContract.View view) {
        this.view = view;
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view2, int i, long l) {
        String itemAtPosition = (String) adapterView.getItemAtPosition(i);
        if (ResUtils.getString(R.string.template_settings).equalsIgnoreCase(itemAtPosition)){
            view.currentActivity().startActivity(new Intent(view.currentActivity(),TemplateActivity.class));
        }
        else if (ResUtils.getString(R.string.about).equalsIgnoreCase(itemAtPosition)){
            view.currentActivity().startActivity(new Intent(view.currentActivity(),AboutActivity.class));
        }
    }
}
